package com.edu.whty.common.tools;

import com.edu.whty.common.constants.Constant;

import java.io.Serializable;

public class ResponseMessage implements Serializable {

	private static final long serialVersionUID = 1L;

	private String result;

	private String resultDesc;

	private Object data;

	public static ResponseMessage getSuccessResponse() {
		ResponseMessage response = new ResponseMessage();
		response.setResult(Constant.SUCCESS_CODE);
		response.setResultDesc(Constant.SUCCESS_MESSAGE);
		return response;
	}

	public static ResponseMessage getSuccessResponse(Object data) {
		ResponseMessage response = new ResponseMessage();
		response.setResult(Constant.SUCCESS_CODE);
		response.setResultDesc(Constant.SUCCESS_MESSAGE);
		response.setData(data);
		return response;
	}

	public static ResponseMessage getFailedResponse() {
		ResponseMessage response = new ResponseMessage();
		response.setResult(Constant.FAILED_CODE);
		response.setResultDesc(Constant.FAILED_MESSAGE);
		return response;
	}

	public static ResponseMessage getResponse(String result, String resultDesc) {
		ResponseMessage response = new ResponseMessage();
		response.setResult(result);
		response.setResultDesc(resultDesc);
		return response;
	}

	public ResponseMessage returnMessage(ResponseMessage resp, String code, String msg, Object data) {
		resp.setResult(code);
		resp.setResultDesc(msg);
		resp.setData(data);
		return resp;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getResultDesc() {
		return resultDesc;
	}

	public void setResultDesc(String resultDesc) {
		this.resultDesc = resultDesc;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

}
